﻿//判断是否是一个合法日期
function validIsDate(psYear, psMonth, psDay) {
    var nYear = parseInt(psYear, 10);
    var nMonth = parseInt(psMonth, 10);
    var nDay = parseInt(psDay, 10);
    if (psYear == "" || psMonth == "" || psDay == "") {
        return false;
    }
    if (nMonth < 1 || 12 < nMonth) {
        return false;
    }
    if (nDay < 1 || 31 < nDay) {
        return false;
    }
    if (nMonth == 2) {
        if ((nYear % 400 == 0) || (nYear % 4 == 0) && (nYear % 100 != 0)) {
            if ((nDay < 1) || (nDay > 29)) {
                return false;
            }
        }
        else {
            if ((nDay < 1) || (nDay > 28)) {
                return false;
            }
        }
    }
    else if ((nMonth == 1) ||
            (nMonth == 3) ||
            (nMonth == 5) ||
            (nMonth == 7) ||
            (nMonth == 8) ||
            (nMonth == 10) ||
            (nMonth == 12)) {
        if ((nDay < 1) || (31 < nDay)) {
            return false;
        }
    }
    else {
        if ((nDay < 1) || (30 < nDay)) {
            return false;
        }
    }
    return true;
}
//判断第一个日期是否小于第二个日期
function validIsDatePeriod(st, ed) {
    var d1 = new Date(st.replace(/\-/g, "\/"));
    var d2 = new Date(ed.replace(/\-/g, "\/"));

    if (d1 < d2) {
        return true;
    } else {
        return false;
    }
}
//-------------------------------------------------------------------------
function valid() {
    alert("submit");
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
